package com.controller.app;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.apidoc.annotation.Api;
import com.apidoc.annotation.ApiAction;
import com.apidoc.annotation.ApiParam;
import com.apidoc.annotation.ApiReqParams;
import com.apidoc.annotation.ApiRespParams;
import com.apidoc.enumeration.DataType;
import com.apidoc.enumeration.Method;
import com.apidoc.enumeration.ParamType;
import com.controller.vo.ShopsApplyVo;
import com.service.IShopsService;
import com.utils.commons.ResponseBean;
import com.utils.enums.ENUM_SUCESS;

@Api(name = "商铺抵押贷", order = 1, mapping = "/wx")
@Controller
@RequestMapping("/wx")
public class WxShopsApplyController {
	
	@Autowired
	private IShopsService shopsService;

	@ApiAction(name = "商铺抵押贷", order = 5, mapping = "/doShopsApply", method = Method.POST)
	@ApiReqParams(type = ParamType.URL_PARAM, value = {
			@ApiParam(name = "customerId", dataType = DataType.STRING, defaultValue = "", description = "客户id"),
			
			@ApiParam(name = "sex", dataType = DataType.STRING, defaultValue = "", description = "客户性别"),
			@ApiParam(name = "userName", dataType = DataType.STRING, defaultValue = "", description = "客户姓名"),
			@ApiParam(name = "idCard", dataType = DataType.STRING, defaultValue = "", description = "客户身份证"),
			@ApiParam(name = "phone", dataType = DataType.STRING, defaultValue = "", description = "客户电话（账号）"),
			
			@ApiParam(name = "commisId", dataType = DataType.STRING, defaultValue = "", required = true, description = "专员id"),
			@ApiParam(name = "workFile", dataType = DataType.STRING, defaultValue = "", description = "客户当前年龄"),
			@ApiParam(name = "payFile", dataType = DataType.STRING, defaultValue = "", description = "贷款年限"),
	})
	@ApiRespParams({
		@ApiParam(name = "status", dataType = DataType.NUMBER, defaultValue = "", description = "状态码"),
		@ApiParam(name = "data", dataType = DataType.OBJECT, defaultValue = "", description = "响应数据", object = "obj"),
		@ApiParam(name = "data", dataType = DataType.OBJECT, defaultValue = "", description = "响应数据", belongTo = "obj"),
		@ApiParam(name = "text", dataType = DataType.STRING, defaultValue = "", description = "提示信息")
	})
	@CrossOrigin(origins = "*")
	@RequestMapping(value = "/doShopsApply", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String doShopsApply(ShopsApplyVo vo) {
		try {
			return ResponseBean.of(shopsService.doApply(vo.toPo()), ENUM_SUCESS.SUCESS.value);
		} catch (Exception e) {
			return ResponseBean.of(ENUM_SUCESS.FAILED.value, e.getMessage());
		}
	}
}
